package common.dataBinding.editor;

import com.txm.model.hibernate.User;

import java.beans.PropertyEditorSupport;

/**
 * Created by geely on 2015/11/22.
 */
public class PropertyEditor extends PropertyEditorSupport {
    public static void main(String[] args) {
        PropertyEditor editor = new PropertyEditor();
        editor.setAsText("tom,22");
        System.out.println(editor.getValue());
    }

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        User u = new User();
        String[] textArray = text.split(",");
        u.setId(1);
        this.setValue(u);
    }
}
